// var i;
// var AL_GAME_HUA_i18nLabel = require("./AL_GAME_HUA_i18nLabel");
// var AL_GAME_HUA_AddPrefab = require("./AL_GAME_HUA_AddPrefab");
// var AL_GAME_HUA_Instance = require("./AL_GAME_HUA_Instance");
// var AL_GAME_HUA_Common = require("./AL_GAME_HUA_Common");
// var AL_GAME_HUA_PopupSelf = require("./AL_GAME_HUA_PopupSelf");
// var AL_GAME_HUA_EventConfig = require("./AL_GAME_HUA_EventConfig");
// var AL_GAME_HUA_GameConst = require("./AL_GAME_HUA_GameConst");
// var AL_GAME_HUA_PropConfig = require("./AL_GAME_HUA_PropConfig");
// var AL_GAME_HUA_CurrencyData = require("./AL_GAME_HUA_CurrencyData");
// var AL_GAME_HUA_GameData = require("./AL_GAME_HUA_GameData");
// var AL_GAME_HUA_GoodsConfig = require("./AL_GAME_HUA_GoodsConfig");
// var AL_GAME_HUA_Define = require("./AL_GAME_HUA_Define");
// var m = cc._decorator;
// var v = m.ccclass;
// var D = m.property;
// var L =
//     (m.menu,
//     (function (e) {
//         function t() {
//             var t = (null !== e && e.apply(this, arguments)) || this;
//             t.anim1 = null;
//             t.anim2 = null;
//             t.node_window_bg = null;
//             t.prop_label = null;
//             t.remark_label = null;
//             t.top_label = null;
//             t.prop_icon = null;
//             t.count_label = null;
//             t.coin_button = null;
//             t.num = 0;
//             return t;
//         }
//         __extends(t, e);
//         t.prototype.start = function () {
//             this.chushihua_donghua();
//             AL_GAME_HUA_Instance.Instance.xianshi_dingbu_tiao({
//                 target: this.node,
//                 showGold: !0
//             });
//         };
//         t.prototype.zhixing_chushihua_chuli = function (e) {
//             var t = this;
//             this.options = e;
//             var n = this.options.id;
//             var o = AL_GAME_HUA_PropConfig.PropConfig.getInstance().huoqu_peizhi_genju_id(n);
//             var i = o.name;
//             var r = o.info;
//             var a = o.type;
//             this.top_label.string = i;
//             this.remark_label.string = r;
//             AL_GAME_HUA_GoodsConfig.GoodsConfig.getInstance()
//                 .jiazai_tubiao_icon(o.goodsId)
//                 .then(function (e) {
//                     t.prop_icon.spriteFrame = e;
//                     t.addAutoReleaseAssets(e);
//                     AL_GAME_HUA_Common.Common.uniform_scale(t.prop_icon, 160, 160);
//                 });
//             var s =
//                 a == AL_GAME_HUA_PropConfig.PropType.ENTER
//                     ? AL_GAME_HUA_GameConst.GameConst.getInstance().video_prop_count_enter
//                     : AL_GAME_HUA_GameConst.GameConst.getInstance().video_prop_count_game;
//             this.count_label.string = "x" + s;
//             this.num = s;
//             this.chushihua_ui();
//         };
//         t.prototype.chushihua_ui = function () {
//             if (AL_GAME_HUA_GameConst.GameConst.getInstance().coin_buy_prop_enabled) {
//                 this.node_window_bg.height = 800;
//                 this.coin_button.node.active = !0;
//                 var e = this.options.id;
//                 var t = AL_GAME_HUA_PropConfig.PropConfig.getInstance().huoqu_peizhi_genju_id(e).price * this.num;
//                 this.coin_button.node.getChildByName("Label").getComponent(cc.Label).string = t.toString();
//             } else {
//                 this.node_window_bg.height = 688;
//                 this.coin_button.node.active = !1;
//             }
//         };
//         t.prototype.chushihua_donghua = function () {
//             cc.tween(this.anim1)
//                 .by(5, {
//                     angle: 360
//                 })
//                 .repeatForever()
//                 .start();
//             cc.tween(this.anim2)
//                 .by(5, {
//                     angle: -360
//                 })
//                 .repeatForever()
//                 .start();
//         };
//         t.prototype.chuli_yincang_hou = function () {
//             if (this.options.onClose) {
//                 this.options.onClose();
//             }
//             if (e.prototype.chuli_yincang_hou) {
//                 e.prototype.chuli_yincang_hou.call(this);
//             }
//         };
//         t.prototype.handle_button_callback = function (e, t) {
//             var n = this;
//             switch (t) {
//                 case "close":
//                     this.close();
//                     break;
//                 case "coin":
//                     var o = [
//                             AL_GAME_HUA_GoodsConfig.GoodsId.prop_magicStick,
//                             AL_GAME_HUA_GoodsConfig.GoodsId.prop_overtime,
//                             AL_GAME_HUA_GoodsConfig.GoodsId.prop_doubleStar,
//                             AL_GAME_HUA_GoodsConfig.GoodsId.prop_prompt,
//                             AL_GAME_HUA_GoodsConfig.GoodsId.prop_reset,
//                             AL_GAME_HUA_GoodsConfig.GoodsId.prop_brush,
//                             AL_GAME_HUA_GoodsConfig.GoodsId.prop_freeze
//                         ][this.options.id],
//                         i = this.options.id,
//                         r = AL_GAME_HUA_PropConfig.PropConfig.getInstance().huoqu_peizhi_genju_id(i).price * this.num;
//                     AL_GAME_HUA_CurrencyData.CurrencyData.getInstance().getHave(
//                         AL_GAME_HUA_CurrencyData.CurrencyType.COIN
//                     ) >= r
//                         ? (this.xianshi_block_top(),
//                           AL_GAME_HUA_Common.Common.bofang_yinxiao("shop_purchase", this),
//                           AL_GAME_HUA_CurrencyData.CurrencyData.getInstance().shiyong_huobi({
//                               type: AL_GAME_HUA_CurrencyData.CurrencyType.COIN,
//                               num: r
//                           }),
//                           AL_GAME_HUA_GameData.GameData.getInstance().genggai_prop_shuliang(this.options.id, this.num),
//                           AL_GAME_HUA_EventConfig.EventConfig.getInstance().assetsReportTransform({
//                               source: AL_GAME_HUA_EventConfig.AssetsSource.game,
//                               action: AL_GAME_HUA_EventConfig.AssetsAction.coin_get,
//                               goodsList: [
//                                   {
//                                       goods: o,
//                                       num: this.num
//                                   },
//                                   {
//                                       goods: AL_GAME_HUA_GoodsConfig.GoodsId.gold,
//                                       num: -r
//                                   }
//                               ]
//                           }),
//                           this.close())
//                         : AL_GAME_HUA_AddPrefab.AddPrefab.chuangjian_tishi_jiedian_mianban({
//                               str: "金币不足"
//                           });
//                     break;
//                 case "video":
//                     var a = [
//                         AL_GAME_HUA_GoodsConfig.GoodsId.prop_magicStick,
//                         AL_GAME_HUA_GoodsConfig.GoodsId.prop_overtime,
//                         AL_GAME_HUA_GoodsConfig.GoodsId.prop_doubleStar,
//                         AL_GAME_HUA_GoodsConfig.GoodsId.prop_prompt,
//                         AL_GAME_HUA_GoodsConfig.GoodsId.prop_reset,
//                         AL_GAME_HUA_GoodsConfig.GoodsId.prop_brush,
//                         AL_GAME_HUA_GoodsConfig.GoodsId.prop_freeze
//                     ][this.options.id];
//                     this.xianshi_block_top();
//                     AL_GAME_HUA_Common.Common.showVideo({
//                         location: AL_GAME_HUA_Define.Define.SHARE_LOCATION.REWARD,
//                         success: function (e) {
//                             AL_GAME_HUA_Common.Common.bofang_yinxiao("shop_purchase", n);
//                             AL_GAME_HUA_GameData.GameData.getInstance().genggai_prop_shuliang(n.options.id, n.num);
//                             AL_GAME_HUA_EventConfig.EventConfig.getInstance().assetsReportOutput({
//                                 source: AL_GAME_HUA_EventConfig.AssetsSource.game,
//                                 action:
//                                     2 == e.type
//                                         ? AL_GAME_HUA_EventConfig.AssetsAction.video_get
//                                         : AL_GAME_HUA_EventConfig.AssetsAction.share_get,
//                                 goodsList: [
//                                     {
//                                         goods: a,
//                                         num: n.num
//                                     }
//                                 ]
//                             });
//                             n.close();
//                         },
//                         completed: function () {
//                             n.yincang_block_top();
//                         }
//                     });
//             }
//         };
//         t.prototype.kongzhi_anniu_hudongxing = function (e, t) {
//             e.interactable = t;
//             var n = e.node.children;
//             var o = t ? e.normalMaterial : e.grayMaterial;
//             for (var i = 0; i < n.length; i++) {
//                 var r = n[i];
//                 r.getComponent(cc.Sprite)
//                     ? r.getComponent(cc.Sprite).setMaterial(0, o)
//                     : r.getComponent(cc.Label) && r.getComponent(cc.Label).setMaterial(0, o);
//             }
//         };
//         __decorate([D(cc.Node)], t.prototype, "anim1", void 0);
//         __decorate([D(cc.Node)], t.prototype, "anim2", void 0);
//         __decorate([D(cc.Node)], t.prototype, "node_window_bg", void 0);
//         __decorate([D(cc.Label)], t.prototype, "prop_label", void 0);
//         __decorate([D(AL_GAME_HUA_i18nLabel.i18nLabel)], t.prototype, "remark_label", void 0);
//         __decorate([D(AL_GAME_HUA_i18nLabel.i18nLabel)], t.prototype, "top_label", void 0);
//         __decorate([D(cc.Sprite)], t.prototype, "prop_icon", void 0);
//         __decorate([D(cc.Label)], t.prototype, "count_label", void 0);
//         __decorate([D(cc.Button)], t.prototype, "coin_button", void 0);
//         return __decorate([v], t);
//     })(AL_GAME_HUA_PopupSelf.default));
// exports.default = L;



// // 引入所需的模块
// var hDPPi18nLabel = require("./AL_GAME_HUA_i18nLabel");
// var hDPPAddPrefab = require("./AL_GAME_HUA_AddPrefab");
// var hDPPInstance = require("./AL_GAME_HUA_Instance");
// var hDPPCommon = require("./AL_GAME_HUA_Common");
// var hDPPPopupSelf = require("./AL_GAME_HUA_PopupSelf");
// var hDPPEventConfig = require("./AL_GAME_HUA_EventConfig");
// var hDPPGameConst = require("./AL_GAME_HUA_GameConst");
// var hDPPPropConfig = require("./AL_GAME_HUA_PropConfig");
// var hDPPCurrencyData = require("./AL_GAME_HUA_CurrencyData");
// var hDPPGameData = require("./AL_GAME_HUA_GameData");
// var hDPPGoodsConfig = require("./AL_GAME_HUA_GoodsConfig");
// var hDPPDefine = require("./AL_GAME_HUA_Define");

// var decorator = cc._decorator;
// var classDecorator = decorator.ccclass;
// var propertyDecorator = decorator.property;

// var ExportedClass = (function (BaseClass) {
//     function ExportedClass() {
//         var thisReference = BaseClass !== null && BaseClass.apply(this, arguments) || this;
//         thisReference.anim1 = null;
//         thisReference.anim2 = null;
//         thisReference.node_window_bg = null;
//         thisReference.prop_label = null;
//         thisReference.remark_label = null;
//         thisReference.top_label = null;
//         thisReference.prop_icon = null;
//         thisReference.count_label = null;
//         thisReference.coin_button = null;
//         thisReference.num = 0;
//         return thisReference;
//     }
    
//     __extends(ExportedClass, BaseClass);
    
//     /** 
//      * 启动时调用的初始化方法
//      */
//     ExportedClass.prototype.start = function () {
//         this.chushihua_donghua();
//         hDPPInstance.Instance.xianshi_dingbu_tiao({
//             target: this.node,
//             showGold: true // 显示金币
//         });
//     };

//     /**
//      * 初始化界面设定
//      * @param {Object} options - 接收的配置参数
//      */
//     ExportedClass.prototype.zhixing_chushihua_chuli = function (options) {
//         this.options = options;
//         var propConfigId = this.options.id;
//         var propConfig = hDPPPropConfig.PropConfig.getInstance().huoqu_peizhi_genju_id(propConfigId);
//         var propName = propConfig.name; // 道具名
//         var propInfo = propConfig.info; // 道具信息
//         var propType = propConfig.type; // 道具类型
//         this.top_label.string = propName;
//         this.remark_label.string = propInfo;
        
//         hDPPGoodsConfig.GoodsConfig.getInstance()
//             .jiazai_tubiao_icon(propConfig.goodsId)
//             .then((spriteFrame) => {
//                 this.prop_icon.spriteFrame = spriteFrame;
//                 this.addAutoReleaseAssets(spriteFrame);
//                 hDPPCommon.Common.uniform_scale(this.prop_icon, 160, 160);
//             });

//         var propCount = propType == hDPPPropConfig.PropType.ENTER
//             ? hDPPGameConst.GameConst.getInstance().video_prop_count_enter
//             : hDPPGameConst.GameConst.getInstance().video_prop_count_game;
        
//         this.count_label.string = "x" + propCount;
//         this.num = propCount;
        
//         this.chushihua_ui();
//     };

//     /**
//      * 初始化UI设定
//      */
//     ExportedClass.prototype.chushihua_ui = function () {
//         if (hDPPGameConst.GameConst.getInstance().coin_buy_prop_enabled) {
//             this.node_window_bg.height = 800;
//             this.coin_button.node.active = true;
//             var propConfigId = this.options.id;
//             var propPrice = hDPPPropConfig.PropConfig.getInstance().huoqu_peizhi_genju_id(propConfigId).price * this.num;
//             this.coin_button.node.getChildByName("Label").getComponent(cc.Label).string = propPrice.toString();
//         } else {
//             this.node_window_bg.height = 688;
//             this.coin_button.node.active = false;
//         }
//     };

//     /**
//      * 初始化动画设定
//      */
//     ExportedClass.prototype.chushihua_donghua = function () {
//         cc.tween(this.anim1).by(5, { angle: 360 }).repeatForever().start();
//         cc.tween(this.anim2).by(5, { angle: -360 }).repeatForever().start();
//     };

//     /**
//      * 界面隐藏后的处理逻辑
//      */
//     ExportedClass.prototype.chuli_yincang_hou = function () {
//         if (this.options.onClose) {
//             this.options.onClose();
//         }
//         if (BaseClass.prototype.chuli_yincang_hou) {
//             BaseClass.prototype.chuli_yincang_hou.call(this);
//         }
//     };

//     /**
//      * 按钮回调事件处理
//      * @param {Object} event - 事件信息
//      * @param {string} buttonName - 按钮名称
//      */
//     ExportedClass.prototype.handle_button_callback = function (event, buttonName) {
//         switch (buttonName) {
//             case "close":
//                 this.close();
//                 break;
//             case "coin":
//                 var selectedGoodsId = [
//                     hDPPGoodsConfig.GoodsId.prop_magicStick,
//                     hDPPGoodsConfig.GoodsId.prop_overtime,
//                     hDPPGoodsConfig.GoodsId.prop_doubleStar,
//                     hDPPGoodsConfig.GoodsId.prop_prompt,
//                     hDPPGoodsConfig.GoodsId.prop_reset,
//                     hDPPGoodsConfig.GoodsId.prop_brush,
//                     hDPPGoodsConfig.GoodsId.prop_freeze
//                 ][this.options.id];

//                 var configId = this.options.id;
//                 var requiredCoins = hDPPPropConfig.PropConfig.getInstance().huoqu_peizhi_genju_id(configId).price * this.num;

//                 if (hDPPCurrencyData.CurrencyData.getInstance().getHave(hDPPCurrencyData.CurrencyType.COIN) >= requiredCoins) {
//                     this.xianshi_block_top();
//                     hDPPCommon.Common.bofang_yinxiao("shop_purchase", this);
//                     hDPPCurrencyData.CurrencyData.getInstance().shiyong_huobi({type: hDPPCurrencyData.CurrencyType.COIN, num: requiredCoins});
//                     hDPPGameData.GameData.getInstance().genggai_prop_shuliang(this.options.id, this.num);
//                     hDPPEventConfig.EventConfig.getInstance().assetsReportTransform({
//                         source: hDPPEventConfig.AssetsSource.game,
//                         action: hDPPEventConfig.AssetsAction.coin_get,
//                         goodsList: [
//                             {
//                                 goods: selectedGoodsId,
//                                 num: this.num
//                             },
//                             {
//                                 goods: hDPPGoodsConfig.GoodsId.gold,
//                                 num: -requiredCoins
//                             }
//                         ]
//                     });
//                     this.close();
//                 } else {
//                     hDPPAddPrefab.AddPrefab.chuangjian_tishi_jiedian_mianban({ str: "金币不足" });
//                 }
//                 break;
//             case "video":
//                 var videoGoodsId = [
//                     hDPPGoodsConfig.GoodsId.prop_magicStick,
//                     hDPPGoodsConfig.GoodsId.prop_overtime,
//                     hDPPGoodsConfig.GoodsId.prop_doubleStar,
//                     hDPPGoodsConfig.GoodsId.prop_prompt,
//                     hDPPGoodsConfig.GoodsId.prop_reset,
//                     hDPPGoodsConfig.GoodsId.prop_brush,
//                     hDPPGoodsConfig.GoodsId.prop_freeze
//                 ][this.options.id];

//                 this.xianshi_block_top();

//                 hDPPCommon.Common.showVideo({
//                     location: hDPPDefine.Define.SHARE_LOCATION.REWARD,
//                     success: (result) => {
//                         hDPPCommon.Common.bofang_yinxiao("shop_purchase", this);
//                         hDPPGameData.GameData.getInstance().genggai_prop_shuliang(this.options.id, this.num);
//                         hDPPEventConfig.EventConfig.getInstance().assetsReportOutput({
//                             source: hDPPEventConfig.AssetsSource.game,
//                             action: result.type == 2 
//                                 ? hDPPEventConfig.AssetsAction.video_get 
//                                 : hDPPEventConfig.AssetsAction.share_get,
//                             goodsList: [
//                                 {
//                                     goods: videoGoodsId,
//                                     num: this.num
//                                 }
//                             ]
//                         });
//                         this.close();
//                     },
//                     completed: () => {
//                         this.yincang_block_top();
//                     }
//                 });
//                 break;
//         }
//     };

//     /**
//      * 控制按钮互动性
//      * @param {cc.Button} button - 按钮实例
//      * @param {boolean} interactable - 是否可操作
//      */
//     ExportedClass.prototype.kongzhi_anniu_hudongxing = function (button, interactable) {
//         button.interactable = interactable;
//         var nodeChildren = button.node.children;
//         var buttonMaterial = interactable ? button.normalMaterial : button.grayMaterial;
//         for (var index = 0; index < nodeChildren.length; index++) {
//             var childNode = nodeChildren[index];
//             if (childNode.getComponent(cc.Sprite)) {
//                 childNode.getComponent(cc.Sprite).setMaterial(0, buttonMaterial);
//             } else if (childNode.getComponent(cc.Label)) {
//                 childNode.getComponent(cc.Label).setMaterial(0, buttonMaterial);
//             }
//         }
//     };

//     __decorate([
//         propertyDecorator(cc.Node)
//     ], ExportedClass.prototype, "anim1", void 0);
    
//     __decorate([
//         propertyDecorator(cc.Node)
//     ], ExportedClass.prototype, "anim2", void 0);
    
//     __decorate([
//         propertyDecorator(cc.Node)
//     ], ExportedClass.prototype, "node_window_bg", void 0);
    
//     __decorate([
//         propertyDecorator(cc.Label)
//     ], ExportedClass.prototype, "prop_label", void 0);
    
//     __decorate([
//         propertyDecorator(hDPPi18nLabel.i18nLabel)
//     ], ExportedClass.prototype, "remark_label", void 0);
    
//     __decorate([
//         propertyDecorator(hDPPi18nLabel.i18nLabel)
//     ], ExportedClass.prototype, "top_label", void 0);
    
//     __decorate([
//         propertyDecorator(cc.Sprite)
//     ], ExportedClass.prototype, "prop_icon", void 0);
    
//     __decorate([
//         propertyDecorator(cc.Label)
//     ], ExportedClass.prototype, "count_label", void 0);
    
//     __decorate([
//         propertyDecorator(cc.Button)
//     ], ExportedClass.prototype, "coin_button", void 0);

//     return __decorate([
//         classDecorator
//     ], ExportedClass);
// })(hDPPPopupSelf.default);

// exports.default = ExportedClass;



// 引入所需的模块
const hDPPi18nLabel = require("./AL_GAME_HUA_i18nLabel");
const hDPPAddPrefab = require("./AL_GAME_HUA_AddPrefab");
const hDPPInstance = require("./AL_GAME_HUA_Instance");
const hDPPCommon = require("./AL_GAME_HUA_Common");
const hDPPPopupSelf = require("./AL_GAME_HUA_PopupSelf");
const hDPPEventConfig = require("./AL_GAME_HUA_EventConfig");
const hDPPGameConst = require("./AL_GAME_HUA_GameConst");
const hDPPPropConfig = require("./AL_GAME_HUA_PropConfig");
const hDPPCurrencyData = require("./AL_GAME_HUA_CurrencyData");
const hDPPGameData = require("./AL_GAME_HUA_GameData");
const hDPPGoodsConfig = require("./AL_GAME_HUA_GoodsConfig");
const hDPPDefine = require("./AL_GAME_HUA_Define");

// 引入 Cocos Creator 的装饰器模块
const { ccclass, property } = cc._decorator;

/**
 * ExportedClass 类
 * 负责道具使用界面的逻辑处理，包括动画、显示、购买和视频奖励功能。
 */
@ccclass
class ExportedClass extends hDPPPopupSelf.default {
    @property(cc.Node)
    anim1 = null;

    @property(cc.Node)
    anim2 = null;

    @property(cc.Node)
    node_window_bg = null;

    @property(cc.Label)
    prop_label = null;

    @property(hDPPi18nLabel.i18nLabel)
    remark_label = null;

    @property(hDPPi18nLabel.i18nLabel)
    top_label = null;

    @property(cc.Sprite)
    prop_icon = null;

    @property(cc.Label)
    count_label = null;

    @property(cc.Button)
    coin_button = null;

    num = 0; // 道具数量

    /**
     * 启动时调用的初始化方法
     */
    start() {
        this.chushihua_donghua(); // 初始化动画
        hDPPInstance.Instance.xianshi_dingbu_tiao({
            target: this.node,
            showGold: true, // 显示金币
        });
    }

    /**
     * 初始化界面设定
     * @param {Object} options - 接收的配置参数
     */
    zhixing_chushihua_chuli(options) {
        this.options = options;
        const propConfig = hDPPPropConfig.PropConfig.getInstance().huoqu_peizhi_genju_id(this.options.id);

        // 设置道具名称和描述
        this.top_label.string = propConfig.name; 
        this.remark_label.string = propConfig.info;

        // 加载道具图标
        hDPPGoodsConfig.GoodsConfig.getInstance()
            .jiazai_tubiao_icon(propConfig.goodsId)
            .then((spriteFrame) => {
                this.prop_icon.spriteFrame = spriteFrame;
                this.addAutoReleaseAssets(spriteFrame);
                hDPPCommon.Common.uniform_scale(this.prop_icon, 160, 160);
            });

        // 设置道具数量
        const propCount =
            propConfig.type === hDPPPropConfig.PropType.ENTER
                ? hDPPGameConst.GameConst.getInstance().video_prop_count_enter
                : hDPPGameConst.GameConst.getInstance().video_prop_count_game;

        this.count_label.string = `x${propCount}`;
        this.num = propCount;

        // 初始化 UI
        this.chushihua_ui();
    }

    /**
     * 初始化UI设定
     */
    chushihua_ui() {
        const gameConst = hDPPGameConst.GameConst.getInstance();
        if (gameConst.coin_buy_prop_enabled) {
            this.node_window_bg.height = 800;
            this.coin_button.node.active = true;
            const propConfig = hDPPPropConfig.PropConfig.getInstance().huoqu_peizhi_genju_id(this.options.id);
            const propPrice = propConfig.price * this.num;
            this.coin_button.node
                .getChildByName("Label")
                .getComponent(cc.Label).string = propPrice.toString();
        } else {
            this.node_window_bg.height = 688;
            this.coin_button.node.active = false;
        }
    }

    /**
     * 初始化动画设定
     */
    chushihua_donghua() {
        cc.tween(this.anim1).by(5, { angle: 360 }).repeatForever().start();
        cc.tween(this.anim2).by(5, { angle: -360 }).repeatForever().start();
    }

    /**
     * 界面隐藏后的处理逻辑
     */
    chuli_yincang_hou() {
        if (this.options.onClose) {
            this.options.onClose();
        }
        // 调用父类的隐藏处理方法
        super.chuli_yincang_hou && super.chuli_yincang_hou();
    }

    /**
     * 按钮回调事件处理
     * @param {Object} event - 事件信息
     * @param {string} buttonName - 按钮名称
     */
    handle_button_callback(event, buttonName) {
        switch (buttonName) {
            case "close":
                this.close();
                break;

            case "coin":
                this.handle_coin_purchase();
                break;

            case "video":
                this.handle_video_reward();
                break;
        }
    }

    /**
     * 处理金币购买逻辑
     */
    handle_coin_purchase() {
        const goodsIdList = [
            hDPPGoodsConfig.GoodsId.prop_magicStick,
            hDPPGoodsConfig.GoodsId.prop_overtime,
            hDPPGoodsConfig.GoodsId.prop_doubleStar,
            hDPPGoodsConfig.GoodsId.prop_prompt,
            hDPPGoodsConfig.GoodsId.prop_reset,
            hDPPGoodsConfig.GoodsId.prop_brush,
            hDPPGoodsConfig.GoodsId.prop_freeze,
        ];
        const selectedGoodsId = goodsIdList[this.options.id];
        const propConfig = hDPPPropConfig.PropConfig.getInstance().huoqu_peizhi_genju_id(this.options.id);
        const requiredCoins = propConfig.price * this.num;

        if (hDPPCurrencyData.CurrencyData.getInstance().getHave(hDPPCurrencyData.CurrencyType.COIN) >= requiredCoins) {
            this.xianshi_block_top();
            hDPPCommon.Common.bofang_yinxiao("shop_purchase", this);
            hDPPCurrencyData.CurrencyData.getInstance().shiyong_huobi({
                type: hDPPCurrencyData.CurrencyType.COIN,
                num: requiredCoins,
            });
            hDPPGameData.GameData.getInstance().genggai_prop_shuliang(this.options.id, this.num);
            hDPPEventConfig.EventConfig.getInstance().assetsReportTransform({
                source: hDPPEventConfig.AssetsSource.game,
                action: hDPPEventConfig.AssetsAction.coin_get,
                goodsList: [
                    { goods: selectedGoodsId, num: this.num },
                    { goods: hDPPGoodsConfig.GoodsId.gold, num: -requiredCoins },
                ],
            });
            this.close();
        } else {
            hDPPAddPrefab.AddPrefab.chuangjian_tishi_jiedian_mianban({ str: "金币不足" });
        }
    }

    /**
     * 处理视频奖励逻辑
     */
    handle_video_reward() {
        const goodsIdList = [
            hDPPGoodsConfig.GoodsId.prop_magicStick,
            hDPPGoodsConfig.GoodsId.prop_overtime,
            hDPPGoodsConfig.GoodsId.prop_doubleStar,
            hDPPGoodsConfig.GoodsId.prop_prompt,
            hDPPGoodsConfig.GoodsId.prop_reset,
            hDPPGoodsConfig.GoodsId.prop_brush,
            hDPPGoodsConfig.GoodsId.prop_freeze,
        ];
        const videoGoodsId = goodsIdList[this.options.id];

        this.xianshi_block_top();

        hDPPCommon.Common.showVideo({
            location: hDPPDefine.Define.SHARE_LOCATION.REWARD,
            success: (result) => {
                hDPPCommon.Common.bofang_yinxiao("shop_purchase", this);
                hDPPGameData.GameData.getInstance().genggai_prop_shuliang(this.options.id, this.num);
                hDPPEventConfig.EventConfig.getInstance().assetsReportOutput({
                    source: hDPPEventConfig.AssetsSource.game,
                    action:
                        result.type === 2
                            ? hDPPEventConfig.AssetsAction.video_get
                            : hDPPEventConfig.AssetsAction.share_get,
                    goodsList: [{ goods: videoGoodsId, num: this.num }],
                });
                this.close();
            },
            completed: () => {
                this.yincang_block_top();
            },
        });
    }

    /**
     * 控制按钮互动性
     * @param {cc.Button} button - 按钮实例
     * @param {boolean} interactable - 是否可操作
     */
    kongzhi_anniu_hudongxing(button, interactable) {
        button.interactable = interactable;
        const buttonMaterial = interactable ? button.normalMaterial : button.grayMaterial;
        button.node.children.forEach((childNode) => {
            const sprite = childNode.getComponent(cc.Sprite);
            const label = childNode.getComponent(cc.Label);
            if (sprite) {
                sprite.setMaterial(0, buttonMaterial);
            } else if (label) {
                label.setMaterial(0, buttonMaterial);
            }
        });
    }
}

module.exports = ExportedClass;
